import {
  UserDeptPostPageParams,
  UserDeptPostPageResultModel,
  AddressListParams,
  SaveUserDeptPostParams,
  AddressUserListParams,
} from './model/systemModel';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  Page = '/admin/userDeptPost/page',
  AddressList = '/admin/address/list',
  AddressUserList = '/admin/address/user/list',
  BatchDel = '/admin/userDeptPost/batchDel',
}
export const getUserDeptPostPage = (params?: UserDeptPostPageParams) =>
  defHttp.get<UserDeptPostPageResultModel>({ url: Api.Page, params });

export const getAddressList = (params?: AddressListParams) =>
  defHttp.post<any>({ url: Api.AddressList, params });

export const getJobConfigurationInformation = (deptId: number | string) =>
  defHttp.post<any>({ url: `/admin/userDeptPost/dept/${deptId}` });

export const getUserList = (deptId: number | string, postId: number | string) =>
  defHttp.post<any>({ url: `/admin/userDeptPost/dept/${deptId}/post/${postId}` });

export const saveUserDeptPost = (params?: SaveUserDeptPostParams) =>
  defHttp.post<any>({ url: `/admin/userDeptPost/saveAll`, params });

export const deleteUserDeptPost = (deptId: number | string, postId: number | string) =>
  defHttp.post<any>({ url: `/admin/userDeptPost/del/dept/${deptId}/post/${postId}` });

export const getAddressUserList = (params?: AddressUserListParams) =>
  defHttp.get<any>({ url: Api.AddressUserList, params });

export const batchDel = (params?: any) => defHttp.post<any>({ url: Api.BatchDel, params });
